package main

import (
	"fmt"
)

func main() {
	/*
		接口的嵌套：
	*/
	var sleep Sleep = Sleep{}
	sleep.test1()
	sleep.test2()
	sleep.test3()

	fmt.Println("------------------------------")
	var a1 A1 = sleep
	a1.test1()

	fmt.Println("------------------------------")
	var b1 B = sleep
	b1.test2()
	fmt.Println("------------------------------")
	var c1 C = sleep
	c1.test1()
	c1.test2()
	c1.test3()

	fmt.Println("------------------------------")
	//var c2 C = a1
	var a2 A1 = c1
	a2.test1()
}

type A1 interface {
	test1()
}

type B interface {
	test2()
}

type C interface {
	A1
	B
	test3()
}

type Sleep struct { //如果想要实现接口C，那不止要实现接口C的方法，还要实现接口A、B中的方法
}

func (s Sleep) test1() {
	fmt.Println("test1...")
}

func (s Sleep) test2() {
	fmt.Println("test2...")
}

func (s Sleep) test3() {
	fmt.Println("test3...")
}
